package com.fwzc.giuseppe.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;

import com.fwzc.giuseppe.R;
import com.fwzc.giuseppe.base.BaseActivity;

public class AddAddress extends BaseActivity implements OnClickListener{
	private Context context = AddAddress.this;
	private EditText et_name,et_phone,et_address,et_zipcode;
	private String name,phone,address,zipcode;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.add_address);
		initBar();
		actionbar_side_name.setText("选择收货地址");
		bg_actionbar_side.setBackgroundColor(getResources().getColor(R.color.transparent));
		iv_actionbar_side_left.setVisibility(View.VISIBLE);
		iv_actionbar_side_left.setOnClickListener(this);
		tv_actionbar_side_right.setVisibility(View.VISIBLE);
		tv_actionbar_side_right.setText("完成");
		tv_actionbar_side_right.setOnClickListener(this);
		initView();
	}
	private void initView() {
		// TODO Auto-generated method stub
		Intent intent = getIntent();
		name = intent.getStringExtra("name");
		phone = intent.getStringExtra("phone");
		address = intent.getStringExtra("address");
		zipcode = intent.getStringExtra("zipcode");
		
		et_name = (EditText) findViewById(R.id.et_name);
		et_phone = (EditText) findViewById(R.id.et_phone);
		et_address = (EditText) findViewById(R.id.et_address);
		et_zipcode = (EditText) findViewById(R.id.et_zipcode);
		
		et_name.setText(name);
		et_phone.setText(phone);
		et_address.setText(address);
		et_zipcode.setText(zipcode);
	}
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		// 返回
		case R.id.iv_actionbar_side_left:
			finish();
			break;
		case R.id.tv_actionbar_side_right:
			startActivity(new Intent(context, SelectAddress.class));
			break;

		default:
			break;
		}
		
	}

}
